<!--- instantiate farcry types --->
<cfset oPresenter=createobject("component", "farcry.plugins.modbreeze.packages.types.modpresenter") />
<cfset oSlide=createobject("component", "farcry.plugins.modbreeze.packages.types.modpresentationslide") />

<!--- slide/presenter decks --->
<cfset aSlides=arrayNew(1) />
<cfset aPresenters=arrayNew(1) />
<cfset lPresenters="" />

<!--- 
loop and build 
 - array of slide arguments and;
 - array of presenter arguments 
--->
<cfloop array="#stobj.deck#" index="i">
	<cfset stSlide=oSlide.getData(objectid=i) />
	
	<cfset args=structNew() />
	<cfset args.title=stSlide.title />
	<cfset args.content=stSlide.content />
	<cfset args.notes=stSlide.notes />
	<cfset args.duration=stSlide.duration />
	<cfset args.advance=stSlide.advance />
	<cfif len(stSlide.video)>
		<cfset args.video="/files" & stSlide.video />
	</cfif>
	
	 <cfif structKeyExists(stslide, "presenter") AND len(stslide.presenter) AND NOT listFindNoCase(lPresenters,stslide.presenter)> 
		<cfset stPresenter=oPresenter.getData(objectid=stslide.presenter) />
		
		<cfset argp=structNew() />
		<cfset argp.name=stPresenter.name />
		<cfset argp.title=stPresenter.title />
		<cfset argp.biography=stPresenter.biography />
		<cfif len(stPresenter.email)>
			<cfset argp.email=stPresenter.email />
		</cfif>
		<cfif len(stPresenter.image)>
			<cfset argp.image=stPresenter.image />
		</cfif>
		<cfif len(stPresenter.logo)>
			<cfset argp.logo=stPresenter.logo />
		</cfif>
		<cfset arrayAppend(aPresenters, argp) />
		<cfset lPresenters=listAppend(lPresenters, stPresenter.objectid) />
		<cfset args.presenter=stPresenter.name />
	 </cfif> 

	<cfset arrayAppend(aSlides, args) />
</cfloop>


<!--- general presentation arguments --->
<cfset args=structNew() />
<cfset args.title=stobj.title />
<cfset args.autoPlay=stobj.autoPlay />
<cfset args.primaryColor="##324e7c" />
<cfset args.glowColor="white" /> 
<cfset args.backgroundColor="##324e7c" />

<!--------------------------------
GENERATE PRESENTATION
--------------------------------->
<cfoutput>

	<cfpresentation
		attributeCollection="#args#">
	
		 <cfloop array="#aPresenters#" index="l">
	 		 <cfpresenter attributeCollection="#l#" /> 
		</cfloop> 
		
		<cfloop array="#aSlides#" index="k">
			<cfset slidecontent="No content provided." />
			<cfif structKeyExists(k, "content")>
				<cfset slidecontent=k.content />
				<cfset structDelete(k, "content") />
			</cfif>
			<cfpresentationslide attributeCollection="#k#">
				<div style="font-family: Verdana;">
					#slidecontent#
				</div>
			</cfpresentationslide>
		</cfloop>
	
	</cfpresentation>

</cfoutput>
